﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LogManager.Base;
using Raven.Client.Indexes;

namespace LogManager.LocalStorage.Indexes
{
    public class LevelIndex
    {
        public string Level { get; set; }
    }

    public class Events_Level : AbstractIndexCreationTask<Event, LevelIndex>
    {
        public Events_Level()
        {
            Map = events =>
                  from e in events
                  where e.Level != null && e.Level != ""
                  select new {Level = e.User};
            Reduce = users =>
                     (from u in users
                      group u by u.Level
                      into g
                          select new { Level = g.Key });
        }
    }
}
